package cn.lxh.constants;


import java.util.Arrays;
import java.util.List;

//常量维护
public class Constants {

    // 姓名正则表达式
    public static final String CHINA_NAME_REGEX = "^[\\u4e00-\\u9fa5]{2,4}$";

    // 手机号正则表达式
    public static final String CHINA_PHONE_REGEX = "^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|(18[0-9])|(19[0-3,5-9]))\\d{8}$";

    // 身份证正则表达式
    public static final String CHINA_ID_CARD_REGEX = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$";

    // 邮箱正则表达式
    public static final String CHINA_EMAIL_REGEX = "^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$";

    // 编码
    public static final String UTF_8 = "UTF-8";


    // 司机服务
    public class Driver {

        // 类型是司机
        public static final int TYPE_DRIVER = 0;
        // 类型是乘客
        public static final int TYPE_CUSTOMER = 1;

        // 实名认证材料待审核
        public static final int AUTH_AUTHENTICATING = 0;
        // 实名认证材料通过
        public static final int AUTH_AUTHENTICATIONED = 1;
        // 实名认证材料拒绝
        public static final int AUTH_REJECT = 2;
        // 司机电话
        public static final String DRIVER_PHONE = "17608104772";
    }

    // 乘客服务
    public class Customer {
        public static final String CUSTOMER_PHONE = "17608104772";
    }

    //管理服务
    public class Admin {
        public static final String ADMIN_PASSWORD = "123456";
        public static final String ADMIN_USERNAME = "admin";
    }

    //远程调用
    public class Remote {
        //服务名
        public static final String SERVICE_UAA = "lxh-flying-car-service-uaa";

        public static final String PREFIX_LOGIN_REMOTE = "/login/remote";
        public static final String SERVICE_RULE = "lxh-flying-car-service-rule";

        public static final String SERVICE_BIGDATA = "lxh-flying-car-service-bigdata";

        public static final String SERVICE_DRIVER = "lxh-flying-car-service-driver";
    }

    // URL
    public class URL {
        // 获取openId
        public static final String OPEN_ID_URL = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code";
        // 获取access_token
        public static final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
        // 获取phoneNumber
        public static final String PHONE_NUMBER_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s";

    }

    //Login
    public class Login {
        public static final int TYPE_ADMIN = 0;
        public static final int TYPE_DRIVER = 1;
        public static final int TYPE_CUSTOMER = 2;

        public static final String HEADER_IMG = "https://img1.baidu.com/it/u=1126296567,2463139079&fm=253&fmt=auto?w=500&h=500";
    }

    // redis
    public class Redis {
        // 登录权限
        public static final String LOGIN_PERMISSIONS = "login_permissions_%s";
        // 司机配置
        public static final String DRIVER_SETTING = "driver_setting_%s";
        // 司机Geo
        public static final String DRIVER_GEO = "driver_geo";
        // 登录信息
        public static final String LOGIN_INFORMATION = "login_information_%s";
        // 订单信
        public static final String ORDER_INFORMATION = "order_information_%s";
        // 锁
        public static final String ORDER_LOCK = "order_lock_%s";
        // 司机坐标
        public static final String DRIVER_LOCATION = "driver_location_%s";
        public static final String KEY_LOCK_PAY_RESULT = "key_lock_pay_result";
        public static final String KEY_LOCK_PAY_RESULT_ORDER = "key_lock_pay_result_order";
    }

    // 订单
    public class Order {
        public static final int ORDER_STATUS_WAIT = 0; // 0等待接单
        public static final int ORDER_STATUS_ACCEPTED = 1; // 1已接单
        public static final int ORDER_STATUS_ARRIVE = 2; // 2司机已到达
        public static final int ORDER_STATUS_START_DRIVING = 3; // 3开始代驾
        public static final int ORDER_STATUS_COMPLETE_DRIVED = 4; // 4结束代驾
        public static final int ORDER_STATUS_ENSURE = 5; // 5司机确认费用
        public static final int ORDER_STATUS_NOT_PAY = 6; // 6未付款
        public static final int ORDER_STATUS_PAYED = 7; // 7已付款
        public static final int ORDER_STATUS_FINISH_ORDER = 8; // 8订单已结束
        public static final int ORDER_STATUS_CUSTOMER_CANCEL_ORDER = 9; // 9顾客撤单
        public static final int ORDER_STATUS_DRIVER_CANCEL_ORDER = 10; // 10司机撤单
        public static final int ORDER_STATUS_ACCIDENT_CLOSE = 11; // 11事故关闭
        public static final int ORDER_STATUS_OTHER = 12; // 12其他
        public static final int ORDER_STATUS_AUTO_CANCEL = 13; // 13自动取消
        // 订单进行中
        public static final List<Integer> ORDER_IN_PROGRESS = Arrays.asList(
                ORDER_STATUS_WAIT,
                ORDER_STATUS_ACCEPTED,
                ORDER_STATUS_ARRIVE,
                ORDER_STATUS_START_DRIVING,
                ORDER_STATUS_COMPLETE_DRIVED,
                ORDER_STATUS_ENSURE,
                ORDER_STATUS_NOT_PAY
        );
        // 司机进行中的订单
        public static final List<Integer> ORDER_IN_PROGRESS_FOR_DRIVER = Arrays.asList(
                ORDER_STATUS_ACCEPTED,
                ORDER_STATUS_ARRIVE,
                ORDER_STATUS_START_DRIVING,
                ORDER_STATUS_COMPLETE_DRIVED,
                ORDER_STATUS_ENSURE
        );
    }

    public class MQ {
        // 消息主题
        public static final String ORDER_TOPIC = "order_topic";
        // 消息标签
        public static final String ORDER_TAGS = "order_tags_%s";
        // 事务消息生产组名
        public static final String TX_PAY_ORDER_PRODUCER = "pay_order_producer";
        // 支付单
        public static final String PAY_ORDER_TOPIC = "pay_order_topic";
        public static final String PAY_ORDER_TAGS = "pay_order_tags";
        // 消费者
        public static final String PAY_ORDER_CONSUMER = "pay_order_consumer";
        public static final String TX_PRODUCER_PAY_RESULT = "tx_producer_pay_result";
        public static final String TOPIC_PAY_RESULT = "topic_pay_result";
        public static final String TAGS_PAY_RESULT = "tags_pay_result";
        public static final String CONSUMER_PAY_RESULT = "consumer_pay_result";
    }


    // 地图
    public class Map {
        // 开车
        public static final String MODE_DRIVING = "driving";
    }

    // 订单分账
    public class OrderSplitting {
        // 未分账
        public static final Integer UN_SHARED = 0;

        // 已分账
        public static final Integer IS_SHARED = 1;
    }

    // 支付
    public class PAY {
        // 待支付
        public static final Integer STATUS_WAIT_PAY = 0;
        // 成功支付
        public static final Integer STATUS_SUCCESS_PAY = 1;
        public static final Integer SHARDING_CANT = 0;
        public static final Integer SHARDING_WAIT = 1;
        public static final Integer SHARDING_PROCESS = 2;
        public static final Integer SHARDING_SUCCESS = 3;
    }

    // 消息
    public class Message {
        // 支付消息
        public static final String MESSAGE_TYPE_PAY = "message_type_pay";
    }
}
